
/**
 * An encapsulation for an image
 * 
 * It just extends the ImageIcon, and provide a method to get
 * the source file corresponding to this ICON.
 * 
 * @author J.J.G.
 */
package fr.emse.tatiana.display;

import javax.swing.ImageIcon;

public class DisplayIcon extends ImageIcon
{
	static final String BROKENIMAGE = "ICONS/broken_icon.png";
    String fn;
    
    public DisplayIcon(String fname)
    {
        super(fname);
        fn = fname;
        int s = getImageLoadStatus();
        if (s != java.awt.MediaTracker.COMPLETE)
        {
        	System.err.println("*** Loading image \""+fn+"\" : error code "+ s);

            // Replace by another image ?
        	ImageIcon ewic = new ImageIcon(BROKENIMAGE);
        	setImage(ewic.getImage());
        }
    }
    
    public String iconName()
    {
    	return fn;
    }
}
